﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Sisocana.Core.Models.PersonaAyudaModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Make a help request
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    
    <script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>" type="text/javascript"></script>
    <% Html.EnableClientValidation(); %>

    <h2>Make a help request</h2>
    
    <% Html.BeginForm("MakeHelpRequest", "Person", FormMethod.Post, new { enctype = "multipart/form-data" }); %>
    
        <fieldset>
            <legend>Name</legend>
            <%= Html.FieldFor(model => model.nombre)%>
            <%= Html.FieldFor(model => model.apellido)%>
        </fieldset>
        <fieldset>
            <legend>Situation description</legend>
        
            <%= Html.Div("editor-label", Html.LabelFor(model => model.descripcionSituacion)) %>
            <%= Html.Div("editor-field", Html.TextAreaFor(model => model.descripcionSituacion)) %>
            <%= Html.ValidationMessageFor(model => Model.descripcionSituacion) %>
        </fieldset>
        <fieldset><legend>Photo</legend>
            <div id="photo-holder"></div>

            <%= Html.Div("editor-label", Html.Label("photo", "Upload a photo")) %>
            <div class="editor-field">
                <input id="photo" type="file" name="photo" />
            </div>

        </fieldset>
        <fieldset>
            <legend>Location</legend>
            <p>Select your location: </p>        
            <%= Html.HiddenFor(model => model.coordX) %>
            <%= Html.HiddenFor(model => model.coordY) %>
            <%= Html.GoogleMap("coordX", "coordY", true) %>
        </fieldset>

        <input type="submit" value="Help me!" />

    <% Html.EndForm(); %>
</asp:Content>

<asp:Content ID="ContentCSS" ContentPlaceHolderID="CSSContent" runat="server">    
    <script src="<%: Url.Content("~/Scripts/googlemap.js") %>" type="text/javascript"></script>
    <script src="<%: Url.Content("~/Scripts/photoPreviewHtml5.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            photoPreview("photo-holder", "photo");
            var map = document.getElementById("map_coordX");
            if (map.style.width == 0) {
                map.style.width = '500px';
                map.style.height = '500px';
                map.style.display = 'block';
                initMap('map_coordX', document.getElementById("coordX"), document.getElementById("coordY"), "True");
                toggleMap('map_coordX');
            }
        }); 
    </script>
</asp:Content>

<script runat="server">
    protected void Page_PreInit(Object sender, EventArgs e)
    {
        Master.MasterPageFile = Url.Content(ViewBag.Site.dir_master);
        MasterPage UserMaster = Master.Master;
        UserMaster.FindControl("NewsTitleContent").Visible = false;
        UserMaster.FindControl("VideoTitleContent").Visible = false;
        UserMaster.FindControl("ImageTitleContent").Visible = false;
    }
</script>